package com.atguigu.srb.sms.config;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
@ConfigurationProperties(prefix = "aliyun.sms")
public class SmsProperties implements InitializingBean {
    private String url;
    private String appCode;
    private String registTemplateId;
    private String loginTemplateId;
    public static String URL;
    public static String APP_CODE;
    public static String REGIST_TEMPLATE_ID;
    public static String LOGIN_TEMPLATE_ID;
    //不希望装配该对象使用，而是通过类名.属性名就可以得到对应的属性值
    //afterPropertiesSet会在当前对象初始化成功后被容器调用一次
    @Override
    public void afterPropertiesSet() throws Exception {
        URL = this.getUrl();
        APP_CODE = this.getAppCode();
        REGIST_TEMPLATE_ID = this.getRegistTemplateId();
        LOGIN_TEMPLATE_ID = this.getLoginTemplateId();
    }


}
